import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EtchedBorder;
import javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout;

public class GamePanel extends JPanel{
	private GameBox[][] gameBox=new GameBox[GameInfo.row][GameInfo.col];
	int[][] turn=new int[GameInfo.row][GameInfo.col];
	public GamePanel(){
		super();
		GridLayout gridLayout=new GridLayout(GameInfo.row, GameInfo.col, 1, 1);
		this.setLayout(gridLayout);
		for(int i=0;i<GameInfo.row;i++){
			for(int j=0;j<GameInfo.col;j++){
				gameBox[i][j]=new GameBox(false);
				this.add(gameBox[i][j]);
				turn[i][j]=0;
			}
		}
	}
	public GameBox[][] get_gameBox(){
		return this.gameBox;
	}
	public void destroy_row() {
		for(int i=0;i<GameInfo.row;i++){
			int j=0;
			for(j=0;j<GameInfo.col;j++){
				if(this.gameBox[i][j].getcolor()==false)
					break;
			}
			if(j==GameInfo.col){
				for(int s=0;s<GameInfo.col;s++){
					this.gameBox[i][s].setcolor(false);
				}
				for(int s=i-1;s>=0;s--){
					for(int k=0;k<GameInfo.col;k++){
						this.gameBox[s+1][k].setcolor(this.gameBox[s][k].getcolor());
					}
				}
			}
		}
	}
	public void record_turn() {
		
	}
}
